# -*- coding: utf-8 -*-

import os
import configparser
from sqlalchemy.engine.url import make_url
from itertools import chain


BRAND_NAME = 'Falcon REST API Template'

SECRET_KEY = 'xs4G5ZD9SwNME6nWRWrK_aq6Yb9H8VJpdwCzkTErFPw='
UUID_LEN = 10
UUID_ALPHABET = ''.join(map(chr, range(48, 58)))
TOKEN_EXPIRES = 3600

APP_ENV = os.environ.get('APP_ENV') or 'local'  # or 'live' to load live
INI_FILE = os.path.join(os.path.dirname(os.path.realpath(__file__)),'../conf/{}.ini'.format(APP_ENV))

CONFIG = configparser.ConfigParser()
CONFIG.read(INI_FILE)
POSTGRESSECTION = CONFIG['postgres']
POSTGRES = make_url(POSTGRESSECTION['db_url'])
DATABASE_URL = POSTGRESSECTION['db_url']

DB_ECHO = True if CONFIG['database']['echo'] == 'yes' else False
DB_AUTOCOMMIT = True

LOG_LEVEL = CONFIG['logging']['level']



